From: Florian Müllner Date: Thu, 26 May 2016 20:20:50 +0000 (+0200) Subject: loginManager: Extend canSuspend() callback X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~851 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=1cb644529f49db0ff378dcd39ad555a35b763294;p=gnome-shell.git loginManager: Extend canSuspend() callback The underlying logind API does not only indicate whether suspend is available, but also whether the user is eligible for executing the operation without further authentication. This information can be relevant, so pass it to the callback. https://bugzilla.gnome.org/show_bug.cgi?id=725960 --- diff --git a/js/misc/loginManager.js b/js/misc/loginManager.js index 7db94d406..3e3df3753 100644 --- a/js/misc/loginManager.js +++ b/js/misc/loginManager.js @@ -134,10 +134,13 @@ const LoginManagerSystemd = new Lang.Class({ canSuspend: function(asyncCallback) { this._proxy.CanSuspendRemote(function(result, error) { - if (error) - asyncCallback(false); - else - asyncCallback(result[0] != 'no' && result[0] != 'na'); + if (error) { + asyncCallback(false, false); + } else { + let needsAuth = result[0] == 'challenge'; + let canSuspend = needsAuth || result[0] == 'yes'; + asyncCallback(canSuspend, needsAuth); + } }); }, @@ -190,7 +193,7 @@ const LoginManagerDummy = new Lang.Class({ }, canSuspend: function(asyncCallback) { - asyncCallback(false); + asyncCallback(false, false); }, listSessions: function(asyncCallback) {